﻿/**
 * [ID]：Log4NetOption
 * [NAME]：Log4NetOption
 * [FUNC]：提供Log4日志文件操作的通用方法
 * [HISTORY]：
 * Date		   User Type 	Action
 * 2011-05-17  韦琪	创建	
 * 
 * */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

[assembly: log4net.Config.DOMConfigurator(ConfigFile = "log4.xml", ConfigFileExtension = "xml", Watch = true)]
namespace Catering
{
    /// <summary>
    ///Log4NetOption 日志文件操作类
    /// </summary>
   
    public class Log4NetOption
    {
        

        /// <summary>
        /// 默认没有添加消息的日志文件
        /// </summary>
        public static void LogWirteer()
        {
            log4net.ILog log = log4net.LogManager.GetLogger("MyLogger");
            //错误信息
            if (log.IsErrorEnabled)
            {
                log.Error("这个是错误信息");
            }
            //警告信息
            if (log.IsWarnEnabled)
            {
                log.Warn("这个是警告信息");
            }
            //描述信息
            if (log.IsInfoEnabled)
            {
                log.Info("这个是描述信息");
            }
        }
        /// <summary>
        /// 添加消息的日志文件
        /// </summary>
        /// <param name="LogMessage">需要写入日志的信息</param>
        public static void LogWirteer(string strLogMessage)
        {

            log4net.ILog log = log4net.LogManager.GetLogger("MyLogger");
            //错误信息
            if (log.IsErrorEnabled)
            {
                log.Error(strLogMessage);
            }
            //警告信息
            if (log.IsWarnEnabled)
            {
                log.Warn(strLogMessage);
            }
            //描述信息
            if (log.IsInfoEnabled)
            {
                log.Info(strLogMessage);
            }
        }
    }
}
